package com.hzq.htest.ui.login.presenter;


import com.hzq.htest.R;
import com.hzq.htest.ui.login.bean.LoginfoBean;
import com.hzq.htest.ui.login.contract.LoginContract;

import kstar.mycommon.baserx.RxSubscriber;

/**
 * Created by ${GuoZhaoHui} on 2017/8/31.
 * email:guozhaohui628@gmail.com
 */

public class LoginPresenter extends LoginContract.Presenter {

    @Override
    public void subLoginDataRequest() {

        mRxManage.add(mModel.getLoginInfo(mView.getRequestParams()).subscribe(new RxSubscriber<LoginfoBean>(mContext) {

            @Override
            public void onStart() {
                super.onStart();
                mView.showLoading(mContext.getString(R.string.loading));
            }

            @Override
            protected void _onNext(LoginfoBean loginfoBean) {
                mView.returnLoginInfo(loginfoBean);
                mView.stopLoading();
            }

            @Override
            protected void _onError(String message) {
                mView.showErrorTip(message);
            }
        }));

    }


}
